package practice8;

public class P2 {

	public static boolean isOk(long num) {
		char[] chs=Long.toString(num).toCharArray();
		//���ҶԳ������ߵ�������
		for(int i=0;i<chs.length/2;i++) {
			if((chs[i]!=chs[chs.length-1-i]) ||(chs[i]>chs[i+1])) {
				return false;
			}
		}
		return true;
	}
	
	public static void main(String[] args) {
		//2022,2022222022
		int ans=0;
		for(long i=2022;i<=2022222022;i++) {
			if(isOk(i)) {
				ans++;
			}
		}
		System.out.println(ans);
	}

}
